package com.uplooking.service.impl;

import javax.transaction.Transactional;
import javax.transaction.Transactional.TxType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import com.uplooking.dao.UserDO;
import com.uplooking.pojo.UserVO;

@Service("userService")
public class UserServiceImpl implements UserDetailsService {

	@Autowired
	private UserDO userDO;

	@Override
	@Transactional(value=TxType.SUPPORTS)
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		UserVO userVO = userDO.findById(username).orElse(null);
		return userVO;
	}
}
